/////////////////////////////////////////////////////////////////////////////
// Name:        mainframe.h
// Purpose:     
// Author:      Brant Young
// Modified by: 
// Created:     Mon May 14 21:45:58 2007
// RCS-ID:      
// Copyright:   Copyright (c) daodict.com 2007
// Licence:     GPL 2.0
/////////////////////////////////////////////////////////////////////////////

#pragma once

#define private public // for access private m_text
#define protected public // for access private m_text
#include <wx/srchctrl.h>
#undef private
#undef protected
#include <wx/listctrl.h>
#include <wx/splitter.h>
#include <wx/frame.h>

class wxHtmlWindow;
class wxSplitterWindow;

class DictManager;
class ConfigManager;
class ThemeManager;

class MainNotebook;
class MainToolBar;
class TaskBarIcon;

/**
 * MainFrame class declaration
 */
class MainFrame: public wxFrame {
public:
    /// Constructors
    MainFrame(int w, int h);
    
    /// Destructor
    virtual ~MainFrame();

    wxBoxSizer* p_main_sizer;
    wxSplitterWindow* p_main_spltwnd;
    wxBoxSizer* p_search_sizer;
    wxSearchCtrl* p_search_ctrl;
    wxPanel* p_search_panel;
    MainToolBar* p_main_toolbar;
    MainNotebook* p_main_notebook;
    wxListView* p_words_list_lbox;

    void relayout();
    void focus_search_ctrl();

    void OnMainFrameCreated(wxCommandEvent& event);
    void OnSearchWord(wxCommandEvent& event);
    void OnSearchButton(wxCommandEvent& event);
    void OnWordUpdated(wxCommandEvent& event);
    void OnCloseWnd(wxCloseEvent& event);
    void OnWordSelected(wxListEvent& event);
    
    void OnSplitUnsplit(wxSplitterEvent& event);
    
    void OnSrchctrlKeyDown(wxKeyEvent& event);
    void OnSrchctrlSetFocus(wxFocusEvent& event);
    void OnSrchctrlKillFocus(wxFocusEvent& event);
    
////@begin MainFrame member variables
    /// Control identifiers
    enum {
        ID_MAIN_FRAME = 10000,
        ID_MAIN_SPLTWND,
        ID_MAIN_STATUSBAR,
        ID_BITMAPBUTTON,
        ID_SEARCH_PANEL,
        ID_SEARCH_CTRL,
        ID_WORDS_LIST_LBOX
    };
////@end MainFrame member variables

protected:
    // MainToolBar* p_main_toolbar;
    
    void InitEvents();
    
    DictManager* p_dictmgr;
    ThemeManager* p_thememgr;
	ConfigManager* p_cfgmgr;
	
	TaskBarIcon* _p_taskbar_icon;
	
	int _prev_sash_pos;
};

